package com.wmyg.antifake.controller;

import com.wmyg.antifake.entity.WxUser;
import com.wmyg.antifake.service.WxUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 王卓逸
 * @program TODO
 * @description TODO
 * @create 2019-05-12
 */
@RestController
public class WxUserController {

    @Autowired
    WxUserService wxUserService;

    @GetMapping(value = "/me")
    public WxUser getUserInfo(String openid, String provisionalId) {
        return wxUserService.getUserInfo(openid, provisionalId);
    }

    @PostMapping(value = "/me")
    public String signNewUser(String openid, String provisionalId) {
        wxUserService.sign(openid, provisionalId);
        return "success";
    }

}
